package com.softserve.academy.food.controllers.datamodel;

import java.util.Date;

import com.softserve.academy.food.entity.eHistoryOrders;
import com.softserve.academy.food.entity.eOrder;

public class ModelHistorydata 
{
	private int id;
	private Date date;
	private String dishes="";
	private int price=0;
	
	public ModelHistorydata()
	{
	}
	
	public ModelHistorydata( eHistoryOrders orders )
	{
		id = orders.getId();
		date = orders.getData();
		
		for ( eOrder order : orders.getOrders()  )
		{
			dishes+= order.getDish().getName();
			price+= order.getDish().getPrice()*100;
		}
	}
	
	public int getId() 
	{
		return id;
	}

	public void setId(int id) 
	{
		this.id = id;
	}

	public Date getDate() 
	{
		return date;
	}

	public void setDate(Date date) 
	{
		this.date = date;
	}

	public String getDishes() 
	{
		return dishes;
	}

	public void setDishes(String dishes) 
	{
		this.dishes = dishes;
	}

	public float getPrice() 
	{
		float floatPrice = price;
		return floatPrice/100;
	}

	public void setPrice(float price) 
	{
		this.price = (int)price*100;
	}

	@Override
	public String toString() 
	{
		return "HistoryOrder [id=" + id + ", date=" + date + ", dishes="
				+ dishes + ", price=" + price + "]";
	}
	
	
}
